package kong

import test.Book
import test.Student

fun main(){
//    test01()
//    test02()
//    test03()
//    test04()
//    test05()
    test6()
}
fun test01(){
    val list1 = listOf<String>("1","2","3")
    val stu = Student("wade",list1)

    println(stu.strings[0])
}
fun test02(){
    val list1 = listOf<String>()
    val stu = Student("wade",list1)
    println(stu.strings.size)
//    println(stu.strings?.elementAt(0)?:"空")
}
fun test03(){
    val stu:Student = Student()
    if(stu==null){
       println("为空")
    }
}

fun test04(){
    val stu = Student("wade")
    println(stu.strings.size)
}

/**
 * ?. 表示?. 安全调用运算符，做了个非空判断，如果为空，返回？：右边的值，不为空，返回左边的值
 */
fun test05(){
    val stu =Student(null,0,null)
    val s =stu?.name ?: "sss"
    println("stuName:"+s)
    val b=stu?.books ?: listOf(Book("xxx",12.0))
    println("st:"+b)
}

fun test6(){
    val s = 1
    val hashRead = (s>0)
    println(hashRead)
}